<?php
include("../connect.php");
$ten_dn = $_GET['ten_dn'];
$email = $_GET['email'];

$sql = "SELECT email FROM thanh_vien WHERE ten_dn='$ten_dn'";
$rs = mysql_query($sql);
$row = mysql_fetch_row($rs);
$email_cu = $row[0];

$sql1 = "SELECT email FROM thanh_vien";
$rs1 = mysql_query($sql1);

while($row1 = mysql_fetch_array($rs1)){
	if($email != $email_cu && $email == $row1[0]){
		echo "Email này đã được sử dụng!";
		exit;
	}
}

echo 'OK';
?>